package entities;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import entities.Application.Status;
import org.hibernate.Session;
import org.hibernate.Transaction;
import persistence.GenericDAO;
import persistence.GenericDAOImpl;
import util.EmailSender;
import util.HibernateUtil;

/**
 *
 * @author Ant Ongun Kefeli
 */
public class NewMain {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        EmailSender es = new EmailSender("anan@zaaa.com", "ongunkefeli@gmail.com", "zaaaa", "zort");
        es.send();
        // TODO code application logic here
        Session session = HibernateUtil.getSessionFactory().getCurrentSession();
        Transaction tx = session.beginTransaction();
        Applicant app = new Applicant();
        app.setCountry("anan");
        Application application = new Application(app);
        application.setStatus(Status.SUBMITTED);
//        app.setApplication(application);
        session.save(app);

        tx.commit();
        GenericDAO<Applicant, Long> dao = new GenericDAOImpl<Applicant, Long>(Applicant.class);
//        app.setApplication(application);
//        dao.update(app);
    }
}
